package org.openfdtd.gui.components;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JToolBar;

/**
 *
 * @author Dórian C. Langbeck
 */
public class ToolBar extends JToolBar {
    public static final int SELECT      = 0;
    public static final int PUSH_PULL   = 1;
    public static final int MOVE_COPY   = 2;
    public static final int ROTATE      = 3;
    public static final int OFFSET      = 4;

    private JButton[] buttons;
    private int currentAction = -1;

    public ToolBar() {
        JButton selectButton = new JButton(getIcon("../icons/24_select.png"));
        selectButton.setToolTipText("Select");
        selectButton.setFocusable(false);
        add(selectButton);

        JButton pushButton = new JButton(getIcon("../icons/24_push-pull.png"));
        pushButton.setToolTipText("Push/Pull");
        pushButton.setFocusable(false);
        add(pushButton);

        JButton moveButton = new JButton(getIcon("../icons/24_move-copy.png"));
        moveButton.setToolTipText("Move/Copy");
        moveButton.setFocusable(false);
        add(moveButton);

        JButton rotateButton = new JButton(getIcon("../icons/24_rotate.png"));
        rotateButton.setToolTipText("Rotate");
        rotateButton.setFocusable(false);
        add(rotateButton);

        JButton offsetButton = new JButton(getIcon("../icons/24_offset.png"));
        offsetButton.setToolTipText("Offset");
        offsetButton.setFocusable(false);
        add(offsetButton);

        buttons = new JButton[] {selectButton, pushButton, moveButton, rotateButton, offsetButton};
    }

    private Icon getIcon(String url) {
        return new ImageIcon(getClass().getResource(url));
    }

    public int getCurrentAction() {
        return currentAction;
    }
}
